﻿using System;
using System.Collections.Generic;
using System.Text;
using ATSModel;
using System.Data;
using System.Data.SqlClient;

namespace ATSDAL
{
    public class TElectResult : BaseRepository_DT<ElecResult>
    {
        #region 静态变量定义部分
        private const string PARM_TEST_PRODUCTSN = "@ProductSN";
        private const string PARM_TEST_MOID = "@MOID";
        #endregion

        // 通过条码与MO号获取电性能测试结果（与物料追溯系统（X9）对接）
        public ElecResult GetTestRe_ProSN(string ProSN, string MOID)
        {
            SqlParameter[] parms = GetParams();
            parms[0].Value = ProSN;
            parms[1].Value = MOID;

            return ExcuteSqlToGetEntity("WEB_ElecProperty", parms);
        }

        private static SqlParameter[] GetParams()
        {
            SqlParameter[] parms = null;
            parms = new SqlParameter[]
            {
                new SqlParameter(PARM_TEST_PRODUCTSN, SqlDbType.NVarChar, 50),
                new SqlParameter(PARM_TEST_MOID, SqlDbType.NVarChar, 50)
            };
            return parms;
        }

        public override ElecResult GetEntityRecord(SqlDataReader rdr)
        {
            ElecResult pro = new ElecResult
            {
                IsPass = rdr.GetValue(0).ToString(),
            };
            return pro;
        }

        public override ElecResult GetEntityRecord()
        {
            ElecResult pro = new ElecResult();
            return pro;
        }
    }
}
